home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / c / library / dos / diverses / cexpress / graphic / rstorbxb.asm < prev    next >
Encoding:
Assembly Source File  |  1989-05-03  |  2.0 KB  |  73 lines

  1. ;void  restore_box_b(box,top_x,top_y,width,depth);
  2. ;  unsigned char  *box,top_x,top_y,width,depth;
  3.  
  4.     EXTRN  _memory_model:byte
  5.     EXTRN  _video_page:byte
  6.  
  7. _TEXT    SEGMENT  BYTE PUBLIC 'CODE'
  8.     ASSUME CS:_TEXT
  9.     PUBLIC _restore_box_b
  10. _restore_box_b proc near
  11.     cld            ;set direction flag
  12.     push bp            ;
  13.     mov  bp,sp        ;set stack frame
  14.     push di            ;
  15.     push si            ;
  16.     cmp  _memory_model,0    ;near or far?
  17.     jle  begin        ;jump if near
  18.     inc  bp            ;else add 2 to BP
  19.     inc  bp            ;
  20. begin:    push ds            ;
  21.     mov  bh,_video_page    ;set video page
  22.     cmp  _memory_model,2    ;data near or far?
  23.     jb   L0            ;jump if near
  24.     lds  si,dword ptr[bp+4] ;DS:SI pts to byte array
  25.     add  bp,2        ;inc BP for dword ptr
  26.     jmp  short L00        ;jump ahead
  27. L0:    mov  si,[bp+4]        ;near case
  28. L00:    mov  dl,[bp+6]        ;topleft column in DL
  29.     dec  dl            ;count from 0
  30.     mov  dh,[bp+8]        ;topleft row in DH
  31.     dec  dh            ;count from 0
  32.     mov  al,[bp+10]        ;width in AL
  33.     mov  ah,[bp+12]        ;depth in AH
  34.     mov  bp,ax        ;copy in BP
  35.     sub  cx,cx        ;clear CX
  36.     mov  cl,al        ;copy width into CX
  37.     mov  di,cx        ;move to DI as counter
  38.     mov  ah,2        ;function to set cursor
  39.     int  10h        ;set the cursor
  40.     push dx            ;save start-of-row pos
  41. L1:    lodsw            ;get char and attri
  42.     mov  bl,ah        ;move attribute to BL
  43.     mov  ah,9        ;func to write char-attri
  44.     mov  cx,1        ;number of chars to write
  45.     int  10h        ;write the char
  46.     dec  di            ;decrement width counter
  47.     jz   L3            ;to next row if last col
  48.     inc  dl            ;incre cursor col
  49. L2:    mov  ah,2        ;function to set cursor
  50.     int  10h        ;reset the cursor
  51.     jmp  short L1        ;go do next character
  52. L3:    pop  dx            ;new row: get old pos
  53.     mov  cx,bp        ;width-depth to CX
  54.     dec  ch            ;decre depth counter
  55.     jz   L4            ;quit if finished
  56.     mov  bp,cx        ;resave depth-width
  57.     sub  ch,ch        ;CX = width
  58.     mov  di,cx        ;transfer to DI as ctr
  59.     inc  dh            ;increase row number
  60.     push dx            ;save for next time
  61.     jmp  short L2        ;go set cursor to nxt row
  62. L4:    pop  ds            ;
  63.     pop  si            ;
  64.     pop  di            ;
  65.     pop  bp            ;
  66.     cmp  _memory_model,0    ;quit
  67.     jle  quit        ;
  68.     db   0CBh        ;RET far
  69. quit:    ret            ;RET near
  70. _restore_box_b endp
  71. _TEXT    ENDS
  72.     END
  73.